------------------------------------------------------------------------------------------------------
       log:  C:\DATA\electoral_measurement.log
  log type:  text
 opened on:  18 May 2005, 10:34:46

.  #delimit ;
delimiter now ;
. *     ***************************************************************** *;
. *     ***************************************************************** *;
. *       File-Name:      electoral_measurement.do                        *;
. *       Date:           5/18/05                                         *;
. *       Author:         MRG                                             *;
. *       Purpose:        Do-file to replicate results for AJPS version   *;
. *                       of presidential candidates paper where          *;
. *                       dependent variable is electoral parties. Now I  *;
. *                       don't drop observations when electoral parties  *;
. *                       is measured with significant error.             *;
. *       Input File:     legislative_newp.dta                            *;
. *       Output File:    electoral_measurement.log                       *;
. *       Data Output:    None                                            *;
. *       Previous file:                                                  *;
. *       Machine:        Home                                            *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. set mem 10m;
(10240k)

. set matsize 150;

. use c:\ajps\legislative_newp.dta;

. *     ****************************************************************  *;
. *                    Relabel and Define Variables                       *;
. *     ****************************************************************  *;
. label var country  "countryname";

. label var newdem "first election as new democracy";

. label var countrynumber "countrynumber";

. label var year "year";

. label var regime "regime as of 31 December of given year 0=democracy 1=dictatorship";

. label var regime_leg "regime type at time of legislative election 0 = democracy 1=dictatorship";

. label var legelec "legislative election";

. label var preselec "presidential election";

. label var eighties "election in 1980s closest to 1985";

. label var old "elections in countries that did not transition to democracy in 1990s";

. label var nineties "elections in 1990s closest to 1995";

. label var proximity1 "proximity - continuous";

. label var proximity2 "proximity - dichotomous";

. label var enpp "parliamentary parties - uncorrected";

. label var enpp1 "parliamentary parties - corrected";

. label var enep "electoral parties - uncorrected";

. label var enep1 "electoral parties - corrected";

. label var enpres "effective number of presidential candidates";

. label var seats "assembly size";

. label var districts "number of electoral districts";

. label var avemag "average district magnitude";

. label var medmag "median district magnitude";

. label var upperseats "number of uppertier seats";

. label var uppertier "percentage of uppertier seats";

. label var eneg "effective number of ethnic groups  fearon";

. describe;

Contains data from c:\ajps\legislative_newp.dta
  obs:           867                          
 vars:            36                          24 May 2004 14:36
 size:        96,237 (99.1% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
country         str31  %31s                   countryname
countrynumber   int    %8.0g                  countrynumber
year            int    %8.0g                  year
institution     byte   %8.0g                  
legelec         byte   %8.0g                  legislative election
preselec        byte   %8.0g                  presidential election
regime          byte   %8.0g                  regime as of 31 December of
                                                given year 0=democracy
                                                1=dictatorship
regime_leg      byte   %8.0g                  regime type at time of
                                                legislative election 0 =
                                                democracy 1=dictatorship
eighties        byte   %8.0g                  election in 1980s closest to
                                                1985
nineties        byte   %8.0g                  elections in 1990s closest to
                                                1995
old             byte   %8.0g                  elections in countries that did
                                                not transition to democracy in
                                                1990s
avemag          float  %9.0g                  average district magnitude
districts       int    %8.0g                  number of electoral districts
eneg            float  %9.0g                  effective number of ethnic
                                                groups  fearon
enep            float  %9.0g                  electoral parties - uncorrected
enep_others     float  %9.0g                  
enep1           float  %9.0g                  electoral parties - corrected
enpp            float  %9.0g                  parliamentary parties -
                                                uncorrected
enpp_others     float  %9.0g                  
enpp1           float  %9.0g                  parliamentary parties -
                                                corrected
enpres          float  %9.0g                  effective number of
                                                presidential candidates
medmag          float  %9.0g                  median district magnitude
newdem          byte   %8.0g                  first election as new democracy
proximity1      float  %9.0g                  proximity - continuous
proximity2      byte   %8.0g                  proximity - dichotomous
seats           int    %8.0g                  assembly size
upperseats      int    %8.0g                  number of uppertier seats
uppertier       float  %9.0g                  percentage of uppertier seats
twoelections    byte   %8.0g                  
twoelections1   byte   %8.0g                  
pres_plurality  byte   %8.0g                  
pres_runoff     byte   %8.0g                  
pres_majority   byte   %8.0g                  
pres_qualmajo~y byte   %8.0g                  
pres_stv        byte   %8.0g                  
pres_college    byte   %8.0g                  
-------------------------------------------------------------------------------
Sorted by:  

. *     ****************************************************************  *;
. *       Would like to drop countries that have no recognizable parties  *;
. *       since I am interested in determining the number of parties.     *;
. *       Drop Kiribati, Marshall Islands, Micronesia, Nauru, Palau,      *;
. *       Lebanon (at least no votes by party), Kyrgzstan.                *;
. *       Since I am interested in competitive elections I drop the       *;
. *       elections that occurred in Colombia between 1958 and 1970 due   *;
. *       to a constitutional agreement to share power between the        *;
. *       conservative and liberal parties.                               *;
. *       Also drop the Congolese elections of 1963.  Although there were *;
. *       multiple parties permitted, all candidates ran on a single list.*;
. *       Thus, there was no actual competition in this election.         *;
. *     ****************************************************************  *;
. drop if countrynumber==163;
(6 observations deleted)

. drop if countrynumber==165;
(2 observations deleted)

. drop if countrynumber==197;
(3 observations deleted)

. drop if countrynumber==189;
(5 observations deleted)

. drop if countrynumber==146;
(12 observations deleted)

. drop if countrynumber==198;
(2 observations deleted)

. drop if countrynumber==167;
(8 observations deleted)

. drop if countrynumber==70 & year==1958;
(1 observation deleted)

. drop if countrynumber==70 & year==1960;
(1 observation deleted)

. drop if countrynumber==70 & year==1962;
(1 observation deleted)

. drop if countrynumber==70 & year==1964;
(1 observation deleted)

. drop if countrynumber==70 & year==1966;
(1 observation deleted)

. drop if countrynumber==70 & year==1968;
(1 observation deleted)

. drop if countrynumber==70 & year==1970;
(1 observation deleted)

. drop if countrynumber==12 & year==1963;
(1 observation deleted)

. sum;

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
     country |         0
countrynum~r |       821     97.3715    37.35025          3        199
        year |       821     1978.35    16.15197       1946       2000
 institution |       821    1.719854    .8927666          1          3
     legelec |       821           1           0          1          1
-------------+--------------------------------------------------------
    preselec |       821    .2180268    .4131574          0          1
      regime |       821    .0207065    .1424866          0          1
  regime_leg |       821           0           0          0          0
    eighties |       821    .0803898    .2720614          0          1
    nineties |       821    .1315469    .3382035          0          1
-------------+--------------------------------------------------------
         old |       821    .8733252    .3328111          0          1
      avemag |       804    11.72699    27.73206          1        150
   districts |       805    96.60373    143.9838          1        659
        eneg |       690    1.889245    1.181049   1.004012   14.22434
        enep |       782    3.878018    1.860428       1.23      14.89
-------------+--------------------------------------------------------
 enep_others |       779    3.171412    7.596386          0       69.3
       enep1 |       779    4.276418    3.829688       1.23      57.56
        enpp |       808     3.23625    1.470687          1      10.87
 enpp_others |       797    1.440527    4.762796          0       54.1
       enpp1 |       796    3.322802    1.756047          1      20.94
-------------+--------------------------------------------------------
      enpres |       815     1.21214    1.616311          0       6.57
      medmag |       664    13.30422    30.42178          1        150
      newdem |       821    .1534714     .360661          0          1
  proximity1 |       821    .2911449    .4150291          0          1
  proximity2 |       821    .2168088    .4123225          0          1
-------------+--------------------------------------------------------
       seats |       814    210.0037    164.1061         11        672
  upperseats |       778    15.61954    46.97577          0        344
   uppertier |       778    5.883021    12.88335          0      77.95
twoelections |       821    .0219245    .1465263          0          1
twoelectio~1 |       821    .0109622    .1041887          0          1
-------------+--------------------------------------------------------
pres_plura~y |       821     .090134    .2865482          0          1
 pres_runoff |       821    .2131547    .4097857          0          1
pres_major~y |       821    .0572473    .2324561          0          1
pres_qualm~y |       821    .0426309    .2021468          0          1
    pres_stv |       821    .0036541    .0603752          0          1
-------------+--------------------------------------------------------
pres_college |       821    .0243605    .1542598          0          1

. *     ****************************************************************  *;
. *       Generate interaction variables ready for regressions.           *;
. *     ****************************************************************  *;
. generate logmag=ln(avemag);
(17 missing values generated)

. generate uppertier_eneg = uppertier*eneg;
(173 missing values generated)

. generate logmag_eneg = logmag*eneg;
(148 missing values generated)

. generate proximity1_enpres = proximity1*enpres;
(6 missing values generated)

. *     ****************************************************************  *;
. *       Need to drop elections that use a fused vote in legislative     *;
. *       and presidential elections.                                     *;
. *       Drop Bolivia, Uruguay, Honduras up to and including the 1993    *;
. *       elections, Guatemala elections in 1990 (fused vote with         *;
. *       national district), Dominican Republic elections in 1966, 1970, *;
. *       1974 and 1986.                                                  *;
. *     ****************************************************************  *;
. drop if countrynumber==67;
(6 observations deleted)

. drop if countrynumber==76;
(10 observations deleted)

. drop if countrynumber==59 & year==1957;
(1 observation deleted)

. drop if countrynumber==59 & year==1971;
(1 observation deleted)

. drop if countrynumber==59 & year==1985;
(1 observation deleted)

. drop if countrynumber==59 & year==1989;
(1 observation deleted)

. drop if countrynumber==59 & year==1993;
(1 observation deleted)

. drop if countrynumber==57 & year==1990;
(1 observation deleted)

. drop if countrynumber==54 & year==1966;
(1 observation deleted)

. drop if countrynumber==54 & year==1970;
(1 observation deleted)

. drop if countrynumber==54 & year==1974;
(1 observation deleted)

. drop if countrynumber==54 & year==1986;
(1 observation deleted)

. sum;

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
     country |         0
countrynum~r |       795    98.37987    37.49907          3        199
        year |       795    1978.405    16.17628       1946       2000
 institution |       795    1.677987    .8761928          1          3
     legelec |       795           1           0          1          1
-------------+--------------------------------------------------------
    preselec |       795    .1924528    .3944749          0          1
      regime |       795    .0201258     .140519          0          1
  regime_leg |       795           0           0          0          0
    eighties |       795    .0779874    .2683206          0          1
    nineties |       795    .1320755    .3387859          0          1
-------------+--------------------------------------------------------
         old |       795    .8691824    .3374131          0          1
      avemag |       780    10.67815    26.32788          1        150
   districts |       781    99.17414    145.3965          1        659
        eneg |       668    1.885193    1.181399   1.004012   14.22434
        enep |       756    3.901045    1.872577       1.23      14.89
-------------+--------------------------------------------------------
 enep_others |       755     3.25645    7.698141          0       69.3
       enep1 |       755    4.307722    3.878852       1.23      57.56
        enpp |       782    3.248376    1.483183          1      10.87
 enpp_others |       772    1.487176    4.832215          0       54.1
       enpp1 |       771    3.336381    1.774226          1      20.94
-------------+--------------------------------------------------------
      enpres |       790    1.150055    1.589989          0       6.57
      medmag |       643    12.05365    28.96131          1        150
      newdem |       795    .1484277    .3557472          0          1
  proximity1 |       795    .2679623    .4011204          0          1
  proximity2 |       795     .191195    .3934898          0          1
-------------+--------------------------------------------------------
       seats |       788    213.4581    165.6253         11        672
  upperseats |       752    16.04122    47.66664          0        344
   uppertier |       752    5.992061    12.95682          0      77.95
twoelections |       795    .0226415    .1488514          0          1
twoelectio~1 |       795    .0113208    .1058617          0          1
-------------+--------------------------------------------------------
pres_plura~y |       795    .0716981    .2581498          0          1
 pres_runoff |       795     .208805    .4067107          0          1
pres_major~y |       795    .0566038    .2312294          0          1
pres_qualm~y |       795    .0352201    .1844518          0          1
    pres_stv |       795    .0037736    .0613521          0          1
-------------+--------------------------------------------------------
pres_college |       795    .0251572    .1567011          0          1
      logmag |       780    1.300769    1.266935          0   5.010635
uppertier_~g |       626    8.788684     28.8885          0   415.1962
 logmag_eneg |       653    2.353421    2.800488          0   25.75041
proximity1~s |       790    .7497948    1.240595          0       6.57

.                *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *               So, now let's run stuff                                 *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *                               1980s                                   *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. regress enep1  proximity1 enpres proximity1_enpres logmag  eneg logmag_eneg if eighties==1, robust;

Regression with robust standard errors                 Number of obs =      41
                                                       F(  6,    34) =    5.22
                                                       Prob > F      =  0.0007
                                                       R-squared     =  0.5035
                                                       Root MSE      =  1.4541

------------------------------------------------------------------------------
             |               Robust
       enep1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  proximity1 |  -2.810738   1.001313    -2.81   0.008     -4.84565   -.7758263
      enpres |   1.184935      .3082     3.84   0.001     .5585972    1.811273
proximity1~s |  -.5836315   .4753703    -1.23   0.228      -1.5497    .3824371
      logmag |  -.3587256   .3208518    -1.12   0.271    -1.010775    .2933236
        eneg |  -.0534598     .05045    -1.06   0.297    -.1559865    .0490668
 logmag_eneg |   .4055558   .2138132     1.90   0.066     -.028965    .8400765
       _cons |   3.396965   .4508299     7.53   0.000     2.480768    4.313161
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *                               1990s                                   *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. regress enep1  proximity1 enpres proximity1_enpres logmag  eneg logmag_eneg if nineties==1, robust;

Regression with robust standard errors                 Number of obs =      76
                                                       F(  6,    69) =    2.99
                                                       Prob > F      =  0.0117
                                                       R-squared     =  0.0872
                                                       Root MSE      =  5.7167

------------------------------------------------------------------------------
             |               Robust
       enep1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  proximity1 |   -4.37463   1.673463    -2.61   0.011    -7.713097   -1.036163
      enpres |   .1156762   .3634899     0.32   0.751    -.6094663    .8408187
proximity1~s |   1.835573   1.082985     1.69   0.095    -.3249234    3.996069
      logmag |  -.2878849   .7764589    -0.37   0.712    -1.836878    1.261108
        eneg |  -.3847964   .5417287    -0.71   0.480    -1.465516    .6959227
 logmag_eneg |   .0042424   .1837193     0.02   0.982    -.3622676    .3707524
       _cons |   6.146229   1.662369     3.70   0.000     2.829893    9.462564
------------------------------------------------------------------------------

. regress enep1  proximity1 enpres proximity1_enpres logmag  eneg logmag_eneg if nineties==1 & old==1,
>  robust;

Regression with robust standard errors                 Number of obs =      43
                                                       F(  6,    36) =    7.17
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.3811
                                                       Root MSE      =  1.6274

------------------------------------------------------------------------------
             |               Robust
       enep1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  proximity1 |  -4.821528    1.11395    -4.33   0.000    -7.080723   -2.562333
      enpres |   .1705935   .1434525     1.19   0.242    -.1203416    .4615287
proximity1~s |    1.23654   .3306582     3.74   0.001     .5659341    1.907146
      logmag |   .0198747   .4972891     0.04   0.968    -.9886744    1.028424
        eneg |   .3879514   .4761954     0.81   0.421    -.5778177     1.35372
 logmag_eneg |   .2694081   .3447394     0.78   0.440    -.4297557    .9685719
       _cons |     3.3191   .9229379     3.60   0.001     1.447296    5.190905
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *        So, now let's look at pooled model                             *;
. *     ****************************************************************  *;
. regress enep1 proximity1 enpres proximity1_enpres eneg logmag logmag_eneg, robust;

Regression with robust standard errors                 Number of obs =     621
                                                       F(  6,   614) =   18.87
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.1162
                                                       Root MSE      =  2.9135

------------------------------------------------------------------------------
             |               Robust
       enep1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  proximity1 |  -3.966316   .6775507    -5.85   0.000    -5.296913   -2.635718
      enpres |   .4083036   .1425997     2.86   0.004     .1282614    .6883458
proximity1~s |   1.116924   .4069307     2.74   0.006     .3177792    1.916069
        eneg |   .0490461   .0910791     0.54   0.590    -.1298182    .2279104
      logmag |   .2060309   .1530597     1.35   0.179     -.094553    .5066149
 logmag_eneg |   .0226137   .0672214     0.34   0.737    -.1093979    .1546254
       _cons |   3.584871   .2829032    12.67   0.000     3.029296    4.140447
------------------------------------------------------------------------------

. regress enep1 proximity1 enpres proximity1_enpres eneg logmag logmag_eneg if old==1, robust;

Regression with robust standard errors                 Number of obs =     539
                                                       F(  6,   532) =   34.48
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.3063
                                                       Root MSE      =  1.4838

------------------------------------------------------------------------------
             |               Robust
       enep1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  proximity1 |  -3.221281   .3746386    -8.60   0.000    -3.957234   -2.485329
      enpres |   .2943087   .0934486     3.15   0.002     .1107353    .4778821
proximity1~s |   .7479622   .1710883     4.37   0.000     .4118707    1.084054
        eneg |   .1386272   .0992026     1.40   0.163    -.0562497     .333504
      logmag |  -.0300783   .1308515    -0.23   0.818    -.2871274    .2269707
 logmag_eneg |   .3258459   .0891314     3.66   0.000     .1507533    .5009386
       _cons |   2.992664   .2061197    14.52   0.000     2.587756    3.397572
------------------------------------------------------------------------------

. regress enep1 proximity1 enpres proximity1_enpres eneg logmag logmag_eneg, robust cluster(country);

Regression with robust standard errors                 Number of obs =     621
                                                       F(  6,    85) =    7.17
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.1162
Number of clusters (country) = 86                      Root MSE      =  2.9135

------------------------------------------------------------------------------
             |               Robust
       enep1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  proximity1 |  -3.966316   .9878157    -4.02   0.000    -5.930358   -2.002273
      enpres |   .4083036   .2520164     1.62   0.109    -.0927726    .9093798
proximity1~s |   1.116924   .5990489     1.86   0.066    -.0741457    2.307994
        eneg |   .0490461   .1435959     0.34   0.734     -.236461    .3345532
      logmag |   .2060309   .2540223     0.81   0.420    -.2990335    .7110954
 logmag_eneg |   .0226137   .1019776     0.22   0.825    -.1801451    .2253726
       _cons |   3.584871   .5007679     7.16   0.000     2.589211    4.580532
------------------------------------------------------------------------------

. regress enep1 proximity1 enpres proximity1_enpres eneg logmag logmag_eneg if old==1, robust cluster(
> country);

Regression with robust standard errors                 Number of obs =     539
                                                       F(  6,    51) =   14.27
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.3063
Number of clusters (country) = 52                      Root MSE      =  1.4838

------------------------------------------------------------------------------
             |               Robust
       enep1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  proximity1 |  -3.221281   .5228645    -6.16   0.000    -4.270975   -2.171587
      enpres |   .2943087   .1658533     1.77   0.082    -.0386557    .6272731
proximity1~s |   .7479622    .224679     3.33   0.002     .2969003    1.199024
        eneg |   .1386272   .1457885     0.95   0.346    -.1540554    .4313097
      logmag |  -.0300783   .2434179    -0.12   0.902    -.5187601    .4586035
 logmag_eneg |   .3258459   .1780674     1.83   0.073    -.0316392    .6833311
       _cons |   2.992664    .345716     8.66   0.000      2.29861    3.686718
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Results show that the coefficient on Proxmity is always negative*;
. *       and signficant and that the coefficient on the interaction term *;
. *       is always positive and significant (with the same exception of  *;
. *       the 1980s cross-section again).                                 *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *                                   THE END                             *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. exit;

end of do-file

.          log close
       log:  C:\DATA\electoral_measurement.log
  log type:  text
 closed on:  18 May 2005, 10:35:07
------------------------------------------------------------------------------------------------------
